package pers.qianyu.month_202101.date_20210110;

/**
 * 201. 数字范围按位与
 * https://leetcode-cn.com/problems/bitwise-and-of-numbers-range/
 *
 * @author mizzle rain
 * @date 2021-01-10 12:51
 */
public class RangeBitwiseAnd {
    public int rangeBitwiseAnd(int m, int n) {
        int shift = 0;
        while (m != n) {
            m >>= 1;
            n >>= 1;
            shift++;
        }
        return m << shift;
    }
}
